<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">  
  <title>鲜花列表</title>
  <link href="css/bootstrap.min.css" rel="stylesheet">

 </head>
 <body>
 
 <?php
  require_once('dbConn.php');
  require_once('myFunc.php');
  connect();
  //编写sql语句
  $sql = 'select lcy_id,lcy_title,lcy_pic,lcy_place,lcy_intro,lcy_adddate,lcy_hint from flower';
  //echo $sql.'<br/>';  
  $result = fetch_array($sql); 
   
 ?>
 <div class="container">
      <div class="row">
 <center><h3>鲜花列表</h3></center>
  <form class="form-horizontal"method="post" action="search.php">
    请输入鲜花标题：
  <input type="text" name="key">
  <input type="submit" name='search' value="搜索">  
 </form> 
   </div>
    </div>
 </td></tr> 
 <table align="center" width="80%" border=1> 

 <tr>
   <th>鲜花id</th>
   <th>鲜花标题</th>   
   <th width='80'>鲜花图片文件名</th>
     <th>鲜花产地</th>
   <th>鲜花简介</th>
   <th>鲜花时间</th>
   <th>点击量</th>
   
   <th>操作</th>
 </tr>

 <?php
  foreach ($result as $row) {
	 echo '<tr>';
	 echo '<td>'.$row['lcy_id'].'</td>';
	 echo '<td><a href="detail.php?id='.$row['lcy_id'].'" >'.$row['lcy_title'].'</a></td>';	 
	 echo '<td align="center"><img src=upload/'.$row['lcy_pic'].' width=60 height=80 alt="无头像"></td>';
   echo '<td>'.$row['lcy_place'].'</td>';   
   echo '<td>'.$row['lcy_intro'].'</td>';    
	 echo '<td>'.$row['lcy_adddate'].'</td>';
   echo '<td>'.$row['lcy_hint'].'</td>';
	
	
	 echo '<td><a href="userEditForm.php?id='.$row['lcy_id'].' ">修改</a> | 
	 <a href="flowerdelete.php?id='.$row['lcy_id'].'" onClick="return confirm(\'确定要删除吗？\');">删除</a></td>';
	 echo '</tr>';  
  }
  
  $totalrows = count($result);
  echo "<table align='center'><tr><td>共有{$totalrows}鲜花</td></tr></table>";   
 ?>
 
 </body>
</html>